package org.springframework.samples.mvc.basic.sluzba;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.mvc.basic.business.AbstractBusinessService;
import org.springframework.samples.mvc.basic.business.Transformer;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.proba.annotations.GenericDAO;
import com.proba.annotations.SluzbaDAO;
import com.proba.annotations.pojo.Sluzba;

@Service
public class SluzbaBusinessServiceImpl extends AbstractBusinessService<Sluzba, SluzbaView> implements SluzbaBusinessService {

	@Autowired
	private SluzbaDAO dao;
	private Transformer<Sluzba, SluzbaView> transformer = new SluzbaTransformer();
	
	@Override
	protected GenericDAO<Sluzba, Long> getDao() {
		return dao;
	}

	@Override
	protected Transformer<Sluzba, SluzbaView> getTransformer() {
		return transformer ;
	}

	@Override
	@Transactional
	public List<SluzbaView> findAll(int startIndex, int pageSize,
			SluzbaView queryInfo) {
		return transform(dao.findByFilterParams(startIndex, pageSize, queryInfo.getId(), queryInfo.getInvestitor()));
	}

}
